package org.sgroup.imenu;

import org.sgroup.imenu.bo.Category;
import org.sgroup.imenu.controladapter.ItemListAdapter;

import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class ListItemView extends LinearLayout {

	public ListItemView(Context context, Category cat) {
		super(context);

		LayoutInflater linflater = (LayoutInflater) ((Activity) context)
				.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
		linflater.inflate(R.layout.list_item, this);
		
		TextView tv = (TextView)findViewById(R.id.caterory_name);
		tv.setText(cat.Name.toUpperCase());
		ListView listview = (ListView)findViewById(R.id.list_item);
		ItemListAdapter  adapter = new ItemListAdapter(context, R.layout.list_item_view, cat.items);
		listview.setAdapter(adapter);
	}
}
